contentMargins
The contentMargins modifier configures custom margins around a view’s content. This allows precise control over layout spacing, particularly in scrollable containers such as ScrollView, List, or Form. You can apply margins uniformly or selectively to certain edges and placement contexts.
Type
Parameters
insets (required)
Defines the margin values to apply. You can provide:
- A single number (applied to all specified edges)
- An
EdgeInsetsobject for per-edge customization
Example – uniform insets:
Example – edge-specific insets:
edges (optional)
Defines which edges the insets should apply to. If omitted, all edges are used.
Type
Example – apply to top and bottom only:
placement (optional)
Specifies where in the layout the margins should be applied. This is especially relevant in scrollable views that have both scrollable content and indicators.
